import 'package:flutter/material.dart';
import 'package:flutter_dwh5/pages/home/goodsDetail/goodsDetail.dart';

class ClassifiCation extends StatefulWidget {
  @override
  State<ClassifiCation> createState() => _ClassifiCationState();
}

class _ClassifiCationState extends State<ClassifiCation> {
  List<Widget> parentTabs = [
    Tab(
      text: '全部',
    ),
    Tab(
      text: '鞋子',
    ),
    Tab(
      text: '衣服',
    )
  ];
  List<Widget> classTabs = [
    Tab(
      text: '全部',
    ),
    Tab(
      text: '男',
    ),
    Tab(
      text: '女',
    )
  ]; //tab指示器
  List<Widget> bodyList = [
    Text('全部'),
    Text('鞋类'),
    Text('衣服类'),
  ];
  List<Widget> wrapList = [
    Container(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Image.asset(
            'images/home/good.png',
            width: 167,
            height: 167,
          ),
          Container(
            margin: EdgeInsets.only(top: 15),
            child: Text(
              'Do－win/多威定制款战神',
              style: TextStyle(fontSize: 14, color: Colors.black),
            ),
          ),
          Container(
            margin: EdgeInsets.only(top: 5),
            child: Text(
              '款号 m966',
              style: TextStyle(
                  fontSize: 10, color: Color.fromRGBO(153, 153, 153, 1)),
            ),
          ),
          Container(
            margin: EdgeInsets.only(top: 5),
            child: Text(
              '￥456.00',
              style: TextStyle(fontSize: 17, color: Colors.black),
            ),
          ),
        ],
      ),
    ),
    Container(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Image.asset(
            'images/home/good.png',
            width: 167,
            height: 167,
          ),
          Container(
            margin: EdgeInsets.only(top: 15),
            child: Text(
              'Do－win/多威定制款战神',
              style: TextStyle(fontSize: 14, color: Colors.black),
            ),
          ),
          Container(
            margin: EdgeInsets.only(top: 5),
            child: Text(
              '款号 m966',
              style: TextStyle(
                  fontSize: 10, color: Color.fromRGBO(153, 153, 153, 1)),
            ),
          ),
          Container(
            margin: EdgeInsets.only(top: 5),
            child: Text(
              '￥456.00',
              style: TextStyle(fontSize: 17, color: Colors.black),
            ),
          ),
        ],
      ),
    ),
    Container(
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Image.asset(
            'images/home/good.png',
            width: 167,
            height: 167,
          ),
          Container(
            margin: EdgeInsets.only(top: 15),
            child: Text(
              'Do－win/多威定制款战神',
              style: TextStyle(fontSize: 14, color: Colors.black),
            ),
          ),
          Container(
            margin: EdgeInsets.only(top: 5),
            child: Text(
              '款号 m966',
              style: TextStyle(
                  fontSize: 10, color: Color.fromRGBO(153, 153, 153, 1)),
            ),
          ),
          Container(
            margin: EdgeInsets.only(top: 5),
            child: Text(
              '￥456.00',
              style: TextStyle(fontSize: 17, color: Colors.black),
            ),
          ),
        ],
      ),
    ),
  ];
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('多威商城'),
        elevation: 0,
      ),
      body: Column(
        children: [
          DefaultTabController(
            length: parentTabs.length,
            child: Row(
              children: [
                Text(
                  '全部商品',
                  style: TextStyle(color: Color.fromRGBO(102, 102, 102, 1)),
                ),
                Container(
                    width: 180,
                    child: TabBar(
                      tabs: parentTabs,
                      indicatorColor: Colors.black,
                      unselectedLabelColor: Color.fromRGBO(102, 102, 102, 1),
                      labelColor: Colors.black,
                      indicatorWeight: 2,
                      isScrollable: true,
                      indicatorSize: TabBarIndicatorSize.label,
                    ))
              ],
            ),
          ),
          DefaultTabController(
            length: classTabs.length,
            child: Row(
              children: [
                Container(
                    width: 180,
                    child: TabBar(
                      tabs: classTabs,
                      indicatorColor: Colors.black,
                      unselectedLabelColor: Color.fromRGBO(102, 102, 102, 1),
                      labelColor: Colors.black,
                      indicatorWeight: 2,
                      isScrollable: true,
                      indicatorSize: TabBarIndicatorSize.label,
                    )),
              ],
            ),
          ),
          SizedBox(
            height: 15,
          ),
          Expanded(
            child: ListView(
              shrinkWrap: true,
              children: [
                Wrap(
                  children: wrapList
                      .map((item) => GestureDetector(
                            onTap: () {
                              Navigator.of(context).push(MaterialPageRoute(
                                  builder: (context) => GoodsDetail(id: 333)));
                            },
                            child: Container(
                              margin: EdgeInsets.only(left: 8),
                              child: item,
                            ),
                          ))
                      .toList(),
                )
              ],
            ),
          ),
        ],
      ),
    );
  }
}
